package com.feishi.core.util.common;

import lombok.Data;

import java.util.*;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: caixq
 * Date: 2020-08-17
 * Time: 下午1:55
 */
public class FourBeat {
    public static int[] getRandomAll(){
        return ArrayUtil.randomIndex(136);
    }
    public static void play(){
        int[][] us=new int[4][14];
        int[][] uOut=new int[4][20];
        int[] all=getRandomAll();
        int allIndex=0;
        for (allIndex = 0; allIndex < 13*4; allIndex++) {
            us[allIndex%4][allIndex/4]=all[allIndex];
        }
        start(all,allIndex,us,uOut);


    }

    private static void start(int[] all, int allIndex, int[][] us,int[][] uOut) {
        int winner=next(all,allIndex,us,uOut,0);
    }

    private static int next(int[] all, int allIndex, int[][] us,int[][] uOut, int i) {
        allIndex++;
        int next=all[allIndex];
        us[i][13]=next;
        Arrays.sort(us[i]);
        System.out.println(Arrays.toString(us[i]));
        One one=new One(us[i]);
        System.out.println(one);
        return 0;
    }

    public static void main(String[] args) {
        play();
    }
    @Data
    static class One{
        public Map<Integer,List<Integer>> as=new HashMap<>();
        public Map<Integer,Integer> map=new HashMap<>();

        public One(int[] u) {
            for (int j = 0; j < u.length; j++) {
                int c=u[j];
                if(c>3*4*9){
                    map.put((c-108)%7,map.getOrDefault((c-108)%7,0)+1);
                }else {
                    List<Integer> list = as.getOrDefault(c / 4 / 9, new ArrayList<>());
                    list.add(c%36%9);
                    as.put(c/4/9,list);
                }
            }
        }
        public int getPowers(List<Integer> list){
            int power=0;
            list.sort(Integer::compareTo);
            for (int i = 0; i < list.size(); i++) {
                Integer v = list.get(i);
                if(v==0){

                }
            }

            return 0;
        }
    }
}
